package com.itheima.config;

/**
 * @Author Andy
 * @Description //TODO BaseContext
 * @Date 2022/3/10 3:00 下午
 * @Version 1.0
 **/
public class BaseContext {

    public static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();

//    get 任何参数不用传，key是当前线程ThreadLocalMap
    public static Long getCurrentId(){
        return threadLocal.get();
    }

    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }
    public static void remove(){
        threadLocal.remove();
    }
}
